﻿@model Mvc4.Models.GoodSetFiles

@{
    ViewBag.Title = "New Good";
    Layout = "~/Views/Shared/_SiteGoodLayout.cshtml"; 
}

<div style="width: 45%; float:left; position:relative; top: 60px; margin-left: 60px;">     
    <h2 class="blue-font-title" style="margin-left: 0;">New Good</h2>     
    @using (Html.BeginForm("NewGood", (string)ViewBag.Name, FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)

        <fieldset>
            <legend>New Good</legend>

            @Html.HiddenFor(model => model.Latitude)
            @Html.HiddenFor(model => model.Longitude)

            <div class="editor-label">
                @Html.Label("Good Name")
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Name)
                @Html.ValidationMessageFor(model => model.Name)
            </div>

            <div class="editor-label">
                @Html.Label("Price")
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.PriceDay)
                @Html.ValidationMessageFor(model => model.PriceDay)
            </div>

            <div class="editor-label">
                @Html.Label("Image")
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.File1, new { type = "file" })
                @Html.ValidationMessageFor(model => model.File1)
            </div>

            <div class="editor-label">
                @Html.Label("Big Image")
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.File2, new { type = "file" })
                @Html.ValidationMessageFor(model => model.File2)
            </div>

            <p>
                <input class="btn btn-primary" type="submit" value="Create" />
            </p>
        </fieldset>

                   
    }

    <div>
        <p class="blue-font not-transform-text">
            @Html.ActionLink("Back to My Stuff", "Index", (string)ViewBag.Name + "/" + "MyStuff")
        </p>
    </div>
</div>
<div style="width: 45%; float:right; position:relative; top: 60px;">  
    <div id="map_canvas" style="width: auto; height: 250px; position:relative; display:block; background: #eee; border: 1px solid #e3e3e3;"></div>        
</div>

@section Scripts {
    <script type="text/javascript">
        function CrearMapa() {
            var mapOptions = {
                center: new google.maps.LatLng(-34.900011,-56.146317),
                zoom: 10,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
            var dr = new google.maps.Marker({
                position: new google.maps.LatLng(-34.900011, -56.146317),
                map: map, // handle of the map 
                draggable: true
            });

            google.maps.event.addListener(
                dr,
                'drag',
                function () {
                    document.getElementById('Latitude').value = dr.position.lat();
                    document.getElementById('Longitude').value = dr.position.lng();
                }
            );
        }

        window.onload = function () {
            CrearMapa();
        };
    </script>
}